-
Notifications
You must be signed in to change notification settings - Fork 370
Add validations for storage pickers #5619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add validations for storage pickers #5619
Conversation
…inahK-2SO/StoragePickers_errorHandling
…inahK-2SO/StoragePickers_errorHandling
bc87f54
to
a18c73b
Compare
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the change looks great. A few small comments.
@@ -33,6 +33,7 @@ namespace winrt::Microsoft::Windows::Storage::Pickers::implementation | |||
} | |||
void FileSavePicker::SettingsIdentifier(hstring const& value) | |||
{ | |||
PickerCommon::ValidateStringNoEmbeddedNulls(value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we care if there are embedded nulls? Same question for the Commit button text.
…inahK-2SO/StoragePickers_errorHandling
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Description
This pull request introduces several enhancements to the
StoragePickers
interop functionality, focusing on validation improvements, refactoring of file type management, and updates to thePickerLocationId
enumeration. The most significant changes include adding validation methods for picker properties, introducing new classes (FileTypeFilterVector
andFileTypeChoicesMap
) to handle file type filtering with validation, and removing obsolete entries from thePickerLocationId
enumeration.Below validations for storage pickers are added:
Their resources can be seen in #5607
Details
Validation Enhancements
PickerCommon::ValidateViewMode
,PickerCommon::ValidateStringNoEmbeddedNulls
,PickerCommon::ValidateSuggestedStartLocation
, andPickerCommon::ValidateSuggestedFileName
) to ensure proper input values for picker properties acrossFileOpenPicker
,FileSavePicker
, andFolderPicker
. These validations prevent invalid or malformed data from being set. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]File Type Management Refactor
FileTypeFilterVector
andFileTypeChoicesMap
classes to centralize file type filtering logic with validation. These classes ensure all file type elements are validated before being added or updated. [1] [2] [3] [4]FileOpenPicker
andFileSavePicker
constructors to utilize these new classes for managing file type filters. [1] [2]PickerLocationId Updates
HomeGroup
) from thePickerLocationId
enumeration and reassigned explicit values to remaining entries for consistency. [1] [2]Additional Improvements
Tests
Adding new tests:
Also verified with existing

StoragePickersTests